#!/usr/bin/make -f

# Assume this script is being executed from the same directory as all of the
# Python scripts.  

# value for INPUT must be set on commandline
# value for OUTPUT must be set on commandline
# value for K must be set on commandline

# Some repetition here because I didn't feel like trying to refresh myself on
# how to do file name substitutions.

all:
	@echo "Specify a target:"
	@echo "  clusters -- generate clusters file."
	@echo "  edgelist -- generate edge list modified with cluster labels."
	@echo "  dot      -- generate dot file of the transformed edgelist."
	@echo "  png      -- generate png image file of the transformed edgelist."
	@echo "Must set INPUT, OUTPUT, and K on the commandline (or environment)."
	@echo "INPUT  -- original edge list file name"
	@echo "OUTPUT -- output file name (for which ever target stage is selected"
	@echo "K      -- number of clusters."

clusters: 
	./randomClusters.py  ${INPUT} ${K}  > ${OUTPUT}

edgelist: 
	./randomClusters.py  ${INPUT} ${K}  > /tmp/random.clusters.txt
	./addClusterLabels.py ${INPUT} /tmp/random.clusters.txt > ${OUTPUT}

dot: 
	./randomClusters.py  ${INPUT} ${K}  > /tmp/random.clusters.txt
	./addClusterLabels.py ${INPUT} /tmp/random.clusters.txt > /tmp/random.clusteredinput.txt
	./dlm2dot.py /tmp/random.clusteredinput.txt > ${OUTPUT}

png: 
	./randomClusters.py  ${INPUT} ${K}  > /tmp/random.clusters.txt
	./addClusterLabels.py ${INPUT} /tmp/random.clusters.txt > /tmp/random.clusteredinput.txt
	./dlm2dot.py /tmp/random.clusteredinput.txt > /tmp/random.clustered.dot
	fdp -Tpng -o ${OUTPUT} /tmp/random.clustered.dot

